Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Aug 21, 2025

Summary

This PR fixes the issue where the UI would get stuck when selecting the Roo provider without being authenticated. The provider selector would become grayed out and unresponsive, preventing users from switching to a different provider.

Problem

When users selected the "Roo" provider without being logged into Roo Code Cloud, the RooHandler constructor would throw an error. While this error was caught, the UI would still become disabled, leaving users unable to switch providers or recover from the error state.

Solution

1. Custom Error Handling

  • Added RooAuthenticationError class for specific Roo authentication failures
  • Wrapped RooHandler instantiation in try-catch to handle auth errors gracefully

2. Pre-flight Authentication Check

  • Added authentication check before task creation in ClineProvider.createTask
  • Shows user-friendly dialog with "Sign In" and "Settings" options
  • Prevents task creation when Roo auth fails

3. UI State Management

  • Added taskCreationFailed message type to unlock UI on auth failure
  • Modified webview message handler to send this message instead of newChat
  • Updated ChatView to handle the new message and re-enable UI controls

4. Internationalization

  • Added translated error messages for all 18 supported locales
  • Added translated button labels ("Sign In" and "Settings") under mdm section
  • All user-facing strings are properly internationalized

Changes

  • src/api/index.ts: Added RooAuthenticationError class and error handling
  • src/core/webview/ClineProvider.ts: Added pre-flight auth check with translated dialog
  • src/core/webview/webviewMessageHandler.ts: Send taskCreationFailed on auth error
  • src/shared/ExtensionMessage.ts: Added new message type and reason field
  • webview-ui/src/components/chat/ChatView.tsx: Handle taskCreationFailed to unlock UI
  • Translation files: Added error messages and button labels in all 18 locales

Testing

  1. Select Roo provider without being authenticated
  2. Verify error dialog appears with translated message
  3. Verify "Sign In" button navigates to account view
  4. Verify "Settings" button opens settings panel
  5. Verify UI remains responsive and provider can be changed

Result

Users can now:

  • See a clear error message when Roo authentication fails
  • Choose to sign in or switch to a different provider
  • Continue working without the UI getting stuck

Fixes the stuck UI state when selecting Roo provider without authentication.


Important

This PR enhances Roo provider authentication handling by introducing specific error handling, UI state management improvements, and internationalization for user-friendly error messages.

  • Behavior:
    • Introduces RooAuthenticationError in index.ts to handle specific authentication failures for the Roo provider.
    • Implements pre-flight authentication check in ClineProvider.createTask to prevent task creation if Roo authentication fails.
    • Displays a dialog with "Sign In" and "Settings" options on authentication failure.
  • UI State Management:
    • Adds taskCreationFailed message type in ExtensionMessage.ts to handle UI unlocking on auth failure.
    • Updates ChatView.tsx to process taskCreationFailed messages, re-enabling UI controls.
  • Internationalization:
    • Adds translated error messages and button labels for 18 locales, ensuring all user-facing strings are internationalized.

This description was created by Ellipsis for 17cbc21. You can customize this summary. It will automatically update as commits are pushed.

@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners August 21, 2025 19:02
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working documentation Improvements or additions to documentation labels Aug 21, 2025
@daniel-lxs
Copy link
Member Author

@roomote-agent use the switch mode tool to switch to pr-fixer mode and solve the conflicts on this PR

@roomote
Copy link
Contributor

roomote bot commented Aug 21, 2025

Hi @daniel-lxs! I see your request to resolve the merge conflicts on this PR. I'll switch to pr-fixer mode now to handle the conflicts on the fix/roo-auth-error-handling branch. Working on it! 🔧

@daniel-lxs daniel-lxs moved this from Triage to PR [Changes Requested] in Roo Code Roadmap Aug 21, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall Review

Thank you for this comprehensive fix for the Roo provider authentication issue! The implementation effectively addresses the UI lockup problem with a well-structured approach.

✅ Strengths

  • Well-structured error handling with custom RooAuthenticationError class
  • Comprehensive UI state management preventing lockups
  • Complete internationalization across all 18 locales
  • Smart pre-flight authentication checks before task creation

⚠️ Critical Issue

This PR has merge conflicts that must be resolved before merging. Please rebase or merge the latest main branch.

📊 Overall Assessment

Score: 8/10 - Solid implementation that effectively solves the reported issue. Once conflicts are resolved and minor improvements considered, this should be ready to merge.

src/api/index.ts Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Consider using the i18n system for this fallback error message to maintain consistency with other user-facing messages:

const errorMessage = error instanceof Error ? error.message : t('common:errors.roo.authenticationRequired')

src/api/index.ts Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Since you're throwing the error on line 161, the console.error might be redundant. Consider either:

  1. Removing the console.error, or
  2. Using a more structured logging approach if debugging info is needed

src/api/index.ts Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhancement: Consider adding JSDoc documentation for better code maintainability:

/**
 * Custom error class for Roo provider authentication failures.
 * Thrown when the Roo provider is selected but user is not authenticated.
 */
export class RooAuthenticationError extends Error {
    constructor(message: string) {
        super(message)
        this.name = "RooAuthenticationError"
        // Ensure proper prototype chain for instanceof checks
        Object.setPrototypeOf(this, RooAuthenticationError.prototype)
    }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type Safety: Consider using instanceof for better type safety:

import { RooAuthenticationError } from "../../api"

// Then use:
if (error instanceof RooAuthenticationError) {
    // Handle authentication error
}

This provides better type checking and is more maintainable than string comparison.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential Enhancement: Consider implementing a retry mechanism that could store the pending task and automatically retry after successful authentication:

if (selection === signInText) {
    // Store pending task for retry
    this.pendingTaskAfterAuth = { text, images, parentTask, options }
    await this.postMessageToWebview({ type: "action", action: "accountButtonClicked" })
}

This would improve UX by not requiring users to manually restart their task.

- Add RooAuthenticationError custom error class for specific error handling
- Pre-check Roo authentication before task creation to prevent UI lock-up
- Send taskCreationFailed message to unlock UI when auth fails
- Add translated error messages and button labels for all 18 locales
- Show user-friendly dialog with Sign In and Settings options
- Prevent UI from getting stuck when Roo provider is selected without authentication

This ensures users can switch providers or sign in when Roo authentication fails,
preventing the stuck state that occurred when selecting Roo without being logged in.
@roomote
Copy link
Contributor

roomote bot commented Aug 21, 2025

Merge conflicts resolved successfully!

I have successfully resolved the merge conflicts in this PR. The conflicts were in the translation files where both the main branch and this PR added new content to the MDM section.

Summary of changes:

  • ✅ Rebased the branch onto the latest main
  • ✅ Resolved conflicts in all 18 translation files (common.json)
  • ✅ Fixed JSON syntax errors that resulted from the merge conflict resolution
  • ✅ All CI checks are now passing

The PR is ready for review and merge.

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Review] in Roo Code Roadmap Aug 21, 2025
@daniel-lxs daniel-lxs closed this Aug 21, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 21, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants